package com.example.sonone.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.kafka.core.KafkaTemplate;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 *  发送者 代码  springboot整合
 */
@RestController
public class KafkaController {


    @Autowired
    private KafkaTemplate kafkaTemplate;

    @RequestMapping("/send")
    public void send() {

        kafkaTemplate.send("mytopic", 0, "key", "this is a msg");
    }


}
